package com.javaspeak.concurrency.pattern.application;

import org.apache.log4j.Logger;

import com.javaspeak.concurrency.pattern.actor.AbstractActor;
import com.javaspeak.concurrency.pattern.actor.ActorRegistry;
import com.javaspeak.concurrency.pattern.actor.ActorRegistryImpl;

/**
 * @author John Dickerson
 */
public class LogTradeActorImpl extends AbstractActor
    implements LogTradeActor{

    public Logger logger = Logger.getLogger( LogTradeActorImpl.class );

    public void logTrade( Trade trade ){

        logger.debug( "Logging Trade with id: " + trade.getTradeId() );

        ActorRegistry actorRegistry = ActorRegistryImpl.getInstance();

        ProcessTradeActor processTradeActor =
            ( ProcessTradeActor )actorRegistry.getActor(
                    ProcessTradeActor.class );

        processTradeActor.processTrade( trade );
    }
}
